COMMON:=common

COMMON_BASEDIR:=$(BASEDIR)/$(COMMON)

COMMON_CC:=g++
COMMON_LD:=g++

COMMON_MODULES_DEPENDENCIES:=mythread

COMMON_INCFLAGS:=-I$(COMMON_BASEDIR)/inc $(patsubst %, -I$(BASEDIR)/%/inc, $(COMMON_MODULES_DEPENDENCIES))

COMMON_DEBUG_CFLAGS:=-g -Wall -fPIC -W -pedantic -Woverloaded-virtual -D_REENTRANT -DDEBUG $(COMMON_INCFLAGS)
COMMON_DEBUG_LDFLAG:=-Wl
COMMON_DEBUG_LIBS:=-lcurl $(patsubst %, $(BASEDI)/lib/debug/lib%.so, $(COMMON_MODULES_DEPENDENCIES))

COMMON_RELEASE_CFLAGS:=-Wall -fPIC -W -pedantic -Woverloaded-virtual -D_REENTRANT -DRELEASE $(COMMON_INCFLAGS)
COMMON_RELEASE_LDFLAG:=-Wl
COMMON_RELEASE_LIBS:=-lcurl $(patsubst %, $(BASEDI)/lib/release/lib%.so, $(COMMON_MODULES_DEPENDENCIES))


COMMON_SRC:=$(shell ls 2>&1 $(COMMON_BASEDIR)/src/*.cpp)

TMP_COMMON_OBJ:= $(patsubst %.cpp,%.o,$(filter %.cpp,$(COMMON_SRC)))
TMP_COMMON_DEP:= $(patsubst %.cpp,%.d,$(filter %.cpp,$(COMMON_SRC)))

SRC+=$(COMMON_SRC)

COMMON_DEBUG_OBJS=$(shell echo $(TMP_COMMON_OBJ) | sed -e 's@src@obj/debug@g' )
COMMON_RELEASE_OBJS+=$(shell echo $(TMP_COMMON_OBJ) | sed -e 's@src@obj/release@g' )

DEBUG_OBJS+=$(COMMON_DEBUG_OBJS)
RELEASE_OBJS+=$(COMMON_RELEASE_OBJS)

# Dependencies are release independant.
DEPS+=$(shell echo $(TMP_COMMON_DEP) | sed -e 's@src@dep@g' )

DEBUG_COMMON_ARCHIVE:=$(BASEDIR)/lib/debug/$(COMMON).a
RELEASE_COMMON_ARCHIVE:=$(BASEDIR)/lib/release/$(COMMON).a

DEBUG_COMMON_LIB:=$(BASEDIR)/lib/debug/lib$(COMMON).so
RELEASE_COMMON_LIB:=$(BASEDIR)/lib/release/lib$(COMMON).so

DEBUG_ARCHIVES+=$(DEBUG_COMMON_ARCHIVE)
RELEASE_ARCHIVES+=$(RELEASE_COMMON_ARCHIVE)

DEBUG_LIBS+=$(DEBUG_COMMON_LIB)
RELEASE_LIBS+=$(RELEASE_COMMON_LIB)
